home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / mac / Chapter Tutorials / DevGallery / Turntable / Source / shocker13bert.dir / 00019.ls < prev    next >
Encoding:
Text File  |  1996-11-10  |  1.7 KB  |  56 lines

  1. on mouseDown
  2.   global gDirection, gStartBack, gStartFor, gPlatform, gUpSnd, gDownSnd, gBeatSnd
  3.   set tangent to (the mouseV - getAt(gOrigin, 2)) / (the mouseH - getAt(gOrigin, 1) + 0.00001)
  4.   set startV to (atan(tangent) / PI) + ((the mouseH - getAt(gOrigin, 1)) < 0)
  5.   repeat while the mouseDown
  6.     if the commandDown then
  7.       sound stop 2
  8.     else
  9.       if not soundBusy(2) then
  10.         puppetSound(2, the number of member gBeatSnd)
  11.       end if
  12.     end if
  13.     if rollOver(1) then
  14.       cursor([the number of member "finger", the number of member "finger mask"])
  15.       set tangent to (the mouseV - getAt(gOrigin, 2)) / (the mouseH - getAt(gOrigin, 1) + 0.00001)
  16.       set currentV to (atan(tangent) / PI) + ((the mouseH - getAt(gOrigin, 1)) < 0)
  17.       if (currentV > startV) and (currentV > 1) and (startV < 0) then
  18.         set startV to 1.60000000000000009
  19.       end if
  20.       if currentV < startV then
  21.         set gDirection to #Forward
  22.         if (the ticks - gStartFor) > 20 then
  23.           set gStartFor to the ticks
  24.           if gPlatform = #PC then
  25.             sound stop 2
  26.           end if
  27.           puppetSound(gUpSnd)
  28.         end if
  29.         if the frame = 13 then
  30.           go(1)
  31.         else
  32.           go(the frame + 1)
  33.         end if
  34.       else
  35.         if currentV > startV then
  36.           set gDirection to #Reverse
  37.           if (the ticks - gStartBack) > 20 then
  38.             set gStartBack to the ticks
  39.             if gPlatform = #PC then
  40.               sound stop 2
  41.             end if
  42.             puppetSound(gDownSnd)
  43.           end if
  44.           if the frame = 1 then
  45.             go(13)
  46.           else
  47.             go(the frame - 1)
  48.           end if
  49.         end if
  50.       end if
  51.       updateStage()
  52.     end if
  53.     set startV to currentV
  54.   end repeat
  55. end
  56.